package com.brsya.movie.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;

import androidx.fragment.app.FragmentTransaction;

import com.brsya.base.base.BaseLayoutActivity;
import com.brsya.base.base.Contents;
import com.brsya.movie.R;
import com.brsya.movie.fragment.InventoryDetailFragment;

/**
 * Created by Brsya
 * CreateDate: 2022/7/7  11:03
 * Description:
 * 片单详情页
 */
public class InventoryDetailActivity extends BaseLayoutActivity {

    private InventoryDetailFragment fragment;
    private String name;
    private int id;
    private int color;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment_box);
        initView();
    }

    private void initView() {

        if (getIntent() != null) {
            if (getIntent().getStringExtra(Contents.INTENT_INVENTORY_NAME) != null) {
                name = getIntent().getStringExtra(Contents.INTENT_INVENTORY_NAME);
            }
            id = getIntent().getIntExtra(Contents.INTENT_INVENTORY_ID, 1);
            color = getIntent().getIntExtra(Contents.INTENT_INVENTORY_COLOR, 0xFF375C3D);
        }


        fragment = InventoryDetailFragment.newInstance(name, id, color, true);

        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.add(R.id.fl_home_fragment_box, fragment);
        fragmentTransaction.commit();

        fragment.setOnBackListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });

    }

}
